<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
    <title>商品搭配管理</title>
</head>
<body>
<div layout:fragment="content">
    <div class="row">
        <div class="col-md-12">
            <div class="btn-group pull-right">
                <a href="index.html" th:href="@{'/goods/goods/index?page='+${page}+'&amp;viewState='+${viewState}}" id="link_return" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
            </div>
        </div>
    </div>
    <div class="row" th:with="selectedGoods=${matchList},selectableGoods=${matchableGoods},casCade=${true}">
        <div>
            <div th:replace="support/searchGoods :: search_form"></div>
        </div>
        <div class="col-md-12">
            <div class="form">
                <form role="form" id="form_goodsMatch" name="form_goodsMatch" th:object="${matchedGoods}"  th:action="@{'/goods/goods/saveGoodsMatch?page='+${page}+'&amp;viewState='+${viewState}}" method="post" class="form-horizontal">
                    <input type="hidden" id="primaryGoodsId" th:field="*{primaryGoodsId}"/>
                    <input type="hidden" id="matchGoodsIds" th:field="*{matchGoodsIds}"/>
                    <!--<b>当前搭配管理商品:<h5 class="form-section" th:text="*{primaryGoodsName}"></h5></b>-->
                    <div class="form-body">
                        <div class="form-group" style="padding-left: 5px;">
                            <div th:replace="support/searchGoods :: search_list"></div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="form-actions fluid">
            <div class="col-md-offset-3 col-md-5">
                <button  id="bt_submit" name="bt_submit" onclick="saveMatchs()" class="btn blue btn-block">提交</button>
            </div>
        </div>
    </div>
    <script th:inline="javascript">
        /*<![CDATA[*/

        function saveMatchs(){
            $('#matchGoodsIds').val(getSelectedGoodsIds());
            $('#form_goodsMatch').submit();
        }
        /*]]>*/
    </script>
</div>
</body>
</html>

